#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

#include <QModbusRtuSerialMaster>
#include <QFile>
#include "serialportlist.h"
#include <QMessageBox>
QT_BEGIN_NAMESPACE

namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void onNewPortList(QStringList portName);
    void on_connectQpushButton_clicked();
    void on_testQpushButton_clicked();
    void on_writeQpushButton_clicked();
    void on_clearQpushButton_clicked();

    void on_hexQcheckBox_stateChanged(int arg1);

private:
    Ui::MainWindow *ui;
    QModbusClient  *modbusDevice = nullptr;
    SerialPortList *portList     = nullptr;

    qint8 portAddr = 1;
    qint16 code    = 1;
    qint16 dateSize    = 1;
    qint16 slaveRegister    = 1;
    int data[16] = {0};
    QString str = {-1};
    qint8 hexMod = 0;  //HEX模式  默认关

};
#endif // MAINWINDOW_H
